package com.aaa.demo07;

/**
 * @author ${崔灿}
 * @date 2022/11/01 16:10
 **/

public class Girl extends Thread{
    @Override
    public void run() {
        synchronized (LockObject.lock2){
            System.out.println(Thread.currentThread().getName()+"获取一个筷子");
            synchronized (LockObject.lock1){
                System.out.println(Thread.currentThread().getName()+"获取另一个筷子");
                System.out.println(Thread.currentThread().getName()+"可以吃饭了");
            }
        }
    }
}
